<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>订单列表</title>
    <link rel="stylesheet" href="__STATIC__/admin/js/layer/theme/default/layer.css">
    <link rel="stylesheet" href="__STATIC__/admin/js/layui/css/layui.css">
    <link rel="stylesheet" href="__STATIC__/admin/js/bootstrap/css/bootstrap.css">
    <script src="__STATIC__/admin/js/html5shiv.min.js"></script>
    <script src="__STATIC__/admin/js/respond.min.js"></script>
    <![endif]-->
    <script src="__STATIC__/admin/js/jquery.min.js"></script>
    <script src="__STATIC__/admin/js/bootstrap/js/bootstrap.min.js"></script>
    <script src="__STATIC__/admin/js/common.js"></script>
    <script src="__STATIC__/admin/js/plugins.js"></script>
    <script src="__STATIC__/admin/js/layer/layer.js"></script>
</head>
<body>
<table class="table table-hover">
    <tr>
        <th>ID</th>
        <th>会员昵称</th>
        <th>支付状态</th>
        <th>课程名字</th>
        <th>购买金额</th>
        <th>订单类型</th>
        <th>下单时间</th>
    </tr>
    {volist name="row" id="vo"}
    <tr>
        <td>{$vo.order_id}</td>
        <td>{$vo.user_name}</td>
        {if condition="$vo['order_status'] eq 0"}
        <td>成功</td>
        {elseif condition="$vo['order_status'] eq 1"}
        <td>失败</td>
        {elseif condition="$vo['order_status'] eq 2"}
        <td>待支付</td>
        {/if}
        <td>{$vo.courses_name}</td>
        <td>{$vo.total_money}元</td>
        {if condition="$vo['order_type'] eq 0"}
        <td>会员</td>
        {elseif condition="$vo['order_type'] eq 1"}
        <td>课程</td>
        {/if}
        <td>{$vo.order_time|date="Y-m-d H:i",###}</td>
        <td><button class="button_1 layui-btn layui-btn-danger" data-id="{$vo.order_id}"><i class="layui-icon"></i>删除</button></td>
    </tr>
    {/volist}
</table>
<script src="__STATIC__/admin/js/layui/layui.js"></script>
<script>
    $(document).ready(function(){
        $(".button_1").click(function () {
            var link = $(this);
            var fid = link.attr("data-id");
            var msg ='您确定要进行操作吗?';
            Plugins.confirm({title:'信息提示',content:msg,okText:'确定',cancelText:'取消',okFun:function(){
                Plugins.closeWindow();
                $.get("{:url('admin/orders/ordersDel')}?id="+fid,function(data){
                    if(data == 1){
                        layer.msg('删除成功');
                        setTimeout(function(){window.location.reload();},2000);
                    }else{
                        layer.msg('删除失败');
                        setTimeout(function(){window.location.reload();},2000);
                    }
                });
            }});
        })
    })
</script>
</body>
</html>